package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.Notification;
import org.iabako.shared.entity.business.NotificationConfig;
import org.iabako.shared.entity.enumeration.NotificationType;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.entity.user.User;

import java.util.List;

/**
 * Created by jose on 13/03/15.
 */
public interface NotificationServiceAsync {

    void calculateNotifications(Enterprise enterprise, AsyncCallback<List<Notification>> async);

    void getUserSessionNotifications(AsyncCallback<List<Notification>> async);

    void getNotifications(Enterprise enterprise, AsyncCallback<List<Notification>> async);

    void calculateNewNotifications(NotificationType[] notificationType, AsyncCallback<List<Notification>> async);

    void hideNotification(Notification notification, AsyncCallback<Void> async);

    void saveNotificationConfig(NotificationConfig entity, AsyncCallback<Void> async);

    void getNotificationsByUser(User user, AsyncCallback<List<Notification>> async);

    public static final class Util {
        private static NotificationServiceAsync instance;

        public static final NotificationServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(NotificationService.class);
            }
            return instance;
        }
    }
}
